package com.xw.Beans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 邮件实体类
 * @author YangJianquan
 */
public class SaveMail implements Serializable{
	
	private static final long serialVersionUID = -7316210502319113789L;
	
	private String id;
	private String fromUser;		//发送人
	private String toUser;			//接收人
	private String ccUser;			//抄送人
	private String ssUser;			//密送人
	private String mailBox;			//当前邮箱账号名
	private Integer mailType;		//邮件类型DD[MAIL_TYPE] 1 接收 2 回复 3 草稿
	private Integer contentType;	//内容类型
	private String content;			//文本类容
	private String title;			//邮件标题
	private String htmlContent;		//HTML内容
	private String attachmentIds;	//附件ID串
	private String messageId;		//邮件messageId
	private String references;		//邮件的关联关系串；
	private String rootMessageId;	//回复类型邮件时，所回复的邮件的第一封的邮件id
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date receiveTime;		//接收时间
	private List<SaveMailAttachment> attachments = new ArrayList<>();		//附件
	
	public String getReferences() {
		return references;
	}
	public void setReferences(String references) {
		this.references = references;
	}
	public Date getReceiveTime() {
		return receiveTime;
	}
	public void setReceiveTime(Date receiveTime) {
		this.receiveTime = receiveTime;
	}
	public List<SaveMailAttachment> getAttachments() {
		return attachments;
	}
	public void setAttachments(List<SaveMailAttachment> attachments) {
		this.attachments = attachments;
	}
	public Integer getMailType() {
		return mailType;
	}
	public void setMailType(Integer mailType) {
		this.mailType = mailType;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getFromUser() {
		return fromUser;
	}
	public void setFromUser(String fromUser) {
		this.fromUser = fromUser;
	}
	public String getToUser() {
		return toUser;
	}
	public void setToUser(String toUser) {
		this.toUser = toUser;
	}
	public String getCcUser() {
		return ccUser;
	}
	public void setCcUser(String ccUser) {
		this.ccUser = ccUser;
	}
	public String getSsUser() {
		return ssUser;
	}
	public void setSsUser(String ssUser) {
		this.ssUser = ssUser;
	}
	public String getMailBox() {
		return mailBox;
	}
	public void setMailBox(String mailBox) {
		this.mailBox = mailBox;
	}
	public Integer getContentType() {
		return contentType;
	}
	public void setContentType(Integer contentType) {
		this.contentType = contentType;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getHtmlContent() {
		return htmlContent;
	}
	public void setHtmlContent(String htmlContent) {
		this.htmlContent = htmlContent;
	}
	public String getAttachmentIds() {
		return attachmentIds;
	}
	public void setAttachmentIds(String attachmentIds) {
		this.attachmentIds = attachmentIds;
	}
	public String getMessageId() {
		return messageId;
	}
	public void setMessageId(String messageId) {
		this.messageId = messageId;
	}
	
	
	public String getRootMessageId() {
		return rootMessageId;
	}
	public void setRootMessageId(String rootMessageId) {
		this.rootMessageId = rootMessageId;
	}
	
	@Override
	public String toString() {
		return "SaveMail [id=" + id + ", fromUser=" + fromUser + ", toUser=" + toUser + ", ccUser=" + ccUser
				+ ", ssUser=" + ssUser + ", mailBox=" + mailBox + ", mailType=" + mailType + ", contentType="
				+ contentType + ", content=" + content + ", title=" + title + ", htmlContent=" + htmlContent
				+ ", attachmentIds=" + attachmentIds + ", messageId=" + messageId + ", references=" + references
				+ ", rootMessageId=" + rootMessageId + ", receiveTime=" + receiveTime + ", attachments=" + attachments
				+ "]";
	}
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof SaveMail) {
			SaveMail mail =  (SaveMail)obj;
			if (this.messageId!=null && messageId.equals(mail.getMessageId())) {
				return true;
			}
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return super.hashCode();
	}
	
	
}
